package net.asciiworks.filesyncr.view {
    import net.asciiworks.filesyncr.ApplicationFacade;
    import net.asciiworks.filesyncr.view.contentPane.DirectorySelectionMediator;
    import net.asciiworks.filesyncr.view.contentPane.SettingsMediator;
    import net.asciiworks.filesyncr.view.contentPane.StatusMediator;
    
    import org.puremvc.as3.interfaces.IMediator;
    import org.puremvc.as3.interfaces.INotification;
    import org.puremvc.as3.patterns.mediator.Mediator;

    public class ContentNavigatorMediator extends Mediator implements IMediator {
        public static const NAME:String = "ContentNavigatorMediator";

        public function ContentNavigatorMediator(viewComponent:ContentNavigator) {
            super(NAME, viewComponent);
			facade.registerMediator(new DirectorySelectionMediator(navigator.directorySelection));
			facade.registerMediator(new StatusMediator(navigator.status));
			facade.registerMediator(new SettingsMediator(navigator.settings));
        }

        override public function listNotificationInterests():Array {
            return [ ApplicationFacade.MENU_CHANGED ];
        }

        override public function handleNotification(note:INotification):void {
            switch (note.getName()) {
                case ApplicationFacade.MENU_CHANGED:
					navigator.selectedIndex = note.getBody() as int;
                    break;
            }
        }

        private function get navigator():ContentNavigator {
            return viewComponent as ContentNavigator;
        }
    }
}